<?php
include_once "../../../../common.php";
$counter = 0;
if(isset($_SESSION['klanten']['id']))
{	// get current pos. 
	$query = "	SELECT 
					W.ID 
				FROM Webshops AS W
					LEFT JOIN WebshopContactpersonen AS WCP ON WCP.WebshopID = W.ID 
												AND WCP.Email != '' 
												AND WCP.Email IS NOT NULL 
				WHERE 1 ";
// filters
	if(isset($_SESSION['klanten']['filter']['status']) && !empty($_SESSION['klanten']['filter']['status']) && is_numeric($_SESSION['klanten']['filter']['status']))
		$query .= " AND W.Status = '".str_replace("'","",$_SESSION['klanten']['filter']['status'])."' ";
	
	if(isset($_SESSION['klanten']['filter']['email']) && !empty($_SESSION['klanten']['filter']['email']) && $_SESSION['klanten']['filter']['email'] == 'geen')
		$query .= " AND WCP.ID IS NULL";
	elseif(isset($_SESSION['klanten']['filter']['email']) && !empty($_SESSION['klanten']['filter']['email']) && $_SESSION['klanten']['filter']['email'] == 'wel')
		$query .= " AND WCP.ID IS NOT NULL";
	
	// filter 
	$query .= " ORDER BY W.ID ASC ";
	$result = $_MySQL->runQuery($query);
	$totaal = mysql_num_rows($result);
	while($row = mysql_fetch_assoc($result))
	{
		$counter++;
		if($_SESSION['klanten']['id'] == $row['ID'])
			break;
	}	
}
echo $counter." van ".$totaal;
?>